import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:tracker/startup/env/env.dart';
import 'package:tracker/theme/app_theme.dart';
import 'package:tracker/utils/upgrade_utils.dart';

class AboutPage extends HookWidget {
  const AboutPage({super.key});

  @override
  Widget build(BuildContext context) {
    final appName = useState(Env.envConfig.appName);
    final appVersion = useState(Env.envConfig.appVersion);
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          "关于",
          style: TextStyle(color: Colors.white),
        ),
        centerTitle: true,
        backgroundColor: AppTheme.themeConfig.primaryColor,
        elevation: 0,
        iconTheme: const IconThemeData(color: Colors.white),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          SizedBox(
              width: 80,
              height: 80,
              child: Image.asset(
                'assets/images/logo/xjww_logo.png',
                fit: BoxFit.cover,
                width: 80,
                height: 80,
              )),
          const SizedBox(
            height: 20,
          ),
          SizedBox(
            width: double.infinity,
            child: Text(
              appName.value,
              textAlign: TextAlign.center,
              style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
          ),
          const SizedBox(
            height: 20,
          ),
          SizedBox(
            width: double.infinity,
            child: Text(
              '版本号: ${appVersion.value}',
              style: TextStyle(color: AppTheme.themeConfig.infoTextColor),
              textAlign: TextAlign.center,
            ),
          ),
          // Container(
          //   width: double.infinity,
          //   child: Text('Build ${Env.envConfig.buildNumber}', style: TextStyle(color: AppTheme.themeConfig.infoTextColor), textAlign: TextAlign.center,),
          // ),
          const SizedBox(
            height: 60,
          ),
          // 检查更新
          TextButton(
            onPressed: () {
              // UpgradeUtils.checkUpdateByManual(context, fromPage: 'about');
            },
            // child: const Text('检查更新'),
            child: const Text('已是最新版'),

          ),
        ],
      ),
    );
  }
}
